//
// CInstanceGroup.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CRefCount;
import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CInstanceGroup extends CRefCount {
  private long swigCPtr;

  public CInstanceGroup(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CInstanceGroup_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CInstanceGroup obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CInstanceGroup(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public long getNumInstance() {
    return nel3dJNI.CInstanceGroup_getNumInstance(swigCPtr, this);
  }

  public String getShapeName(long instanceNb) {
    return nel3dJNI.CInstanceGroup_getShapeName__SWIG_0(swigCPtr, this, instanceNb);
  }

  public String getInstanceName(long instanceNb) {
    return nel3dJNI.CInstanceGroup_getInstanceName(swigCPtr, this, instanceNb);
  }

  public CVector getInstancePos(long instanceNb) {
    return new CVector(nel3dJNI.CInstanceGroup_getInstancePos(swigCPtr, this, instanceNb), false);
  }

  public SWIGTYPE_p_NLMISC__CQuat getInstanceRot(long instanceNb) {
    return new SWIGTYPE_p_NLMISC__CQuat(nel3dJNI.CInstanceGroup_getInstanceRot(swigCPtr, this, instanceNb), false);
  }

  public CVector getInstanceScale(long instanceNb) {
    return new CVector(nel3dJNI.CInstanceGroup_getInstanceScale(swigCPtr, this, instanceNb), false);
  }

  public void getInstanceMatrix(long instanceNb, SWIGTYPE_p_NLMISC__CMatrix dest) {
    nel3dJNI.CInstanceGroup_getInstanceMatrix(swigCPtr, this, instanceNb, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(dest));
  }

  public int getInstanceParent(long instanceNb) {
    return nel3dJNI.CInstanceGroup_getInstanceParent(swigCPtr, this, instanceNb);
  }

  public SWIGTYPE_p_NL3D__CInstanceGroup__CInstance getInstance(long instanceNb) {
    return new SWIGTYPE_p_NL3D__CInstanceGroup__CInstance(nel3dJNI.CInstanceGroup_getInstance__SWIG_0(swigCPtr, this, instanceNb), false);
  }

  public CVector getGlobalPos() {
    return new CVector(nel3dJNI.CInstanceGroup_getGlobalPos(swigCPtr, this), false);
  }

  public CTransformShape getTransformShape(long instanceNb) {
    long cPtr = nel3dJNI.CInstanceGroup_getTransformShape(swigCPtr, this, instanceNb);
    return (cPtr == 0) ? null : new CTransformShape(cPtr, false);
  }

  public CInstanceGroup() {
    this(nel3dJNI.new_CInstanceGroup(), true);
  }

  public void build(CVector vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t array, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t Clusters, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t Portals) {
    nel3dJNI.CInstanceGroup_build__SWIG_0(swigCPtr, this, CVector.getCPtr(vGlobalPos), vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(array), SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(Clusters), SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(Portals));
  }

  public void build(CVector vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t array, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t Clusters, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t Portals, SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t pointLightList, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t retrieverGridMap, float igSurfaceLightCellSize) {
    nel3dJNI.CInstanceGroup_build__SWIG_1(swigCPtr, this, CVector.getCPtr(vGlobalPos), vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(array), SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(Clusters), SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(Portals), SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t.getCPtr(pointLightList), SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t.getCPtr(retrieverGridMap), igSurfaceLightCellSize);
  }

  public void build(CVector vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t array, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t Clusters, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t Portals, SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t pointLightList, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t retrieverGridMap) {
    nel3dJNI.CInstanceGroup_build__SWIG_2(swigCPtr, this, CVector.getCPtr(vGlobalPos), vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(array), SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(Clusters), SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(Portals), SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t.getCPtr(pointLightList), SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CRetrieverLightGrid_t.getCPtr(retrieverGridMap));
  }

  public void build(CVector vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t array, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t Clusters, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t Portals, SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t pointLightList) {
    nel3dJNI.CInstanceGroup_build__SWIG_3(swigCPtr, this, CVector.getCPtr(vGlobalPos), vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(array), SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(Clusters), SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(Portals), SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t.getCPtr(pointLightList));
  }

  public void retrieve(CVector vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t array, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t Clusters, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t Portals, SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t pointLightList) {
    nel3dJNI.CInstanceGroup_retrieve(swigCPtr, this, CVector.getCPtr(vGlobalPos), vGlobalPos, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(array), SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(Clusters), SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(Portals), SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t.getCPtr(pointLightList));
  }

  public void serial(IStream f) {
    nel3dJNI.CInstanceGroup_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void createRoot(CScene scene) {
    nel3dJNI.CInstanceGroup_createRoot(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public void setTransformNameCallback(ITransformName pTN) {
    nel3dJNI.CInstanceGroup_setTransformNameCallback(swigCPtr, this, ITransformName.getCPtr(pTN), pTN);
  }

  public void setAddRemoveInstanceCallback(IAddRemoveInstance callback) {
    nel3dJNI.CInstanceGroup_setAddRemoveInstanceCallback(swigCPtr, this, IAddRemoveInstance.getCPtr(callback), callback);
  }

  public void setIGAddBeginCallback(IIGAddBegin callback) {
    nel3dJNI.CInstanceGroup_setIGAddBeginCallback(swigCPtr, this, IIGAddBegin.getCPtr(callback), callback);
  }

  public boolean addToScene(CScene scene, IDriver driver, long selectedTexture) {
    return nel3dJNI.CInstanceGroup_addToScene__SWIG_0(swigCPtr, this, CScene.getCPtr(scene), scene, IDriver.getCPtr(driver), driver, selectedTexture);
  }

  public boolean addToScene(CScene scene, IDriver driver) {
    return nel3dJNI.CInstanceGroup_addToScene__SWIG_1(swigCPtr, this, CScene.getCPtr(scene), scene, IDriver.getCPtr(driver), driver);
  }

  public boolean addToScene(CScene scene) {
    return nel3dJNI.CInstanceGroup_addToScene__SWIG_2(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public boolean addToSceneAsync(CScene scene, IDriver driver, long selectedTexture) {
    return nel3dJNI.CInstanceGroup_addToSceneAsync__SWIG_0(swigCPtr, this, CScene.getCPtr(scene), scene, IDriver.getCPtr(driver), driver, selectedTexture);
  }

  public boolean addToSceneAsync(CScene scene, IDriver driver) {
    return nel3dJNI.CInstanceGroup_addToSceneAsync__SWIG_1(swigCPtr, this, CScene.getCPtr(scene), scene, IDriver.getCPtr(driver), driver);
  }

  public boolean addToSceneAsync(CScene scene) {
    return nel3dJNI.CInstanceGroup_addToSceneAsync__SWIG_2(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public void stopAddToSceneAsync() {
    nel3dJNI.CInstanceGroup_stopAddToSceneAsync(swigCPtr, this);
  }

  public CInstanceGroup.TState getAddToSceneState() {
    return CInstanceGroup.TState.swigToEnum(nel3dJNI.CInstanceGroup_getAddToSceneState(swigCPtr, this));
  }

  public void getShapeName(long instanceIndex, SWIGTYPE_p_std__string shapeName) {
    nel3dJNI.CInstanceGroup_getShapeName__SWIG_1(swigCPtr, this, instanceIndex, SWIGTYPE_p_std__string.getCPtr(shapeName));
  }

  public void setUserInterface(UInstanceGroup uig) {
    nel3dJNI.CInstanceGroup_setUserInterface(swigCPtr, this, UInstanceGroup.getCPtr(uig), uig);
  }

  public UInstanceGroup getUserInterface() {
    long cPtr = nel3dJNI.CInstanceGroup_getUserInterface(swigCPtr, this);
    return (cPtr == 0) ? null : new UInstanceGroup(cPtr, false);
  }

  public void displayDebugClusters(IDriver drv, CTextContext txtCtx) {
    nel3dJNI.CInstanceGroup_displayDebugClusters(swigCPtr, this, IDriver.getCPtr(drv), drv, CTextContext.getCPtr(txtCtx), txtCtx);
  }

  public boolean removeFromScene(CScene scene) {
    return nel3dJNI.CInstanceGroup_removeFromScene(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public void getLights(SWIGTYPE_p_std__setT_std__string_t LightNames) {
    nel3dJNI.CInstanceGroup_getLights(swigCPtr, this, SWIGTYPE_p_std__setT_std__string_t.getCPtr(LightNames));
  }

  public void getBlendShapes(SWIGTYPE_p_std__setT_std__string_t BlendShapeNames) {
    nel3dJNI.CInstanceGroup_getBlendShapes(swigCPtr, this, SWIGTYPE_p_std__setT_std__string_t.getCPtr(BlendShapeNames));
  }

  public void setBlendShapeFactor(String BlendShapeName, float rFactor) {
    nel3dJNI.CInstanceGroup_setBlendShapeFactor(swigCPtr, this, BlendShapeName, rFactor);
  }

  public void addCluster(CCluster pCluster) {
    nel3dJNI.CInstanceGroup_addCluster(swigCPtr, this, CCluster.getCPtr(pCluster), pCluster);
  }

  public void setClusterSystemForInstances(CInstanceGroup pIG) {
    nel3dJNI.CInstanceGroup_setClusterSystemForInstances(swigCPtr, this, CInstanceGroup.getCPtr(pIG), pIG);
  }

  public void getDynamicPortals(Vector_String names) {
    nel3dJNI.CInstanceGroup_getDynamicPortals(swigCPtr, this, Vector_String.getCPtr(names), names);
  }

  public void setDynamicPortal(SWIGTYPE_p_std__string name, boolean opened) {
    nel3dJNI.CInstanceGroup_setDynamicPortal(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(name), opened);
  }

  public boolean getDynamicPortal(SWIGTYPE_p_std__string name) {
    return nel3dJNI.CInstanceGroup_getDynamicPortal(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(name));
  }

  public void linkRoot(CScene scene, CTransform father) {
    nel3dJNI.CInstanceGroup_linkRoot(swigCPtr, this, CScene.getCPtr(scene), scene, CTransform.getCPtr(father), father);
  }

  public void setPos(CVector pos) {
    nel3dJNI.CInstanceGroup_setPos(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public void setRotQuat(SWIGTYPE_p_NLMISC__CQuat quat) {
    nel3dJNI.CInstanceGroup_setRotQuat(swigCPtr, this, SWIGTYPE_p_NLMISC__CQuat.getCPtr(quat));
  }

  public CVector getPos() {
    return new CVector(nel3dJNI.CInstanceGroup_getPos(swigCPtr, this), true);
  }

  public SWIGTYPE_p_NLMISC__CQuat getRotQuat() {
    return new SWIGTYPE_p_NLMISC__CQuat(nel3dJNI.CInstanceGroup_getRotQuat(swigCPtr, this), true);
  }

  public void freezeHRC() {
    nel3dJNI.CInstanceGroup_freezeHRC(swigCPtr, this);
  }

  public void unfreezeHRC() {
    nel3dJNI.CInstanceGroup_unfreezeHRC(swigCPtr, this);
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t getPointLightList() {
    return new SWIGTYPE_p_std__vectorT_NL3D__CPointLightNamed_t(nel3dJNI.CInstanceGroup_getPointLightList(swigCPtr, this), false);
  }

  public long getNumPointLights() {
    return nel3dJNI.CInstanceGroup_getNumPointLights(swigCPtr, this);
  }

  public CPointLightNamed getPointLightNamed(long index) {
    return new CPointLightNamed(nel3dJNI.CInstanceGroup_getPointLightNamed(swigCPtr, this, index), false);
  }

  public void setPointLightFactor(CScene scene) {
    nel3dJNI.CInstanceGroup_setPointLightFactor(swigCPtr, this, CScene.getCPtr(scene), scene);
  }

  public boolean getStaticLightSetup(CRGBA sunAmbient, long retrieverIdentifier, int surfaceId, CVector localPos, SWIGTYPE_p_std__vectorT_NL3D__CPointLightInfluence_t pointLightList, SWIGTYPE_p_unsigned_char sunContribution, CRGBA localAmbient) {
    return nel3dJNI.CInstanceGroup_getStaticLightSetup(swigCPtr, this, CRGBA.getCPtr(sunAmbient), sunAmbient, retrieverIdentifier, surfaceId, CVector.getCPtr(localPos), localPos, SWIGTYPE_p_std__vectorT_NL3D__CPointLightInfluence_t.getCPtr(pointLightList), SWIGTYPE_p_unsigned_char.getCPtr(sunContribution), CRGBA.getCPtr(localAmbient), localAmbient);
  }

  public CIGSurfaceLight getIGSurfaceLight() {
    return new CIGSurfaceLight(nel3dJNI.CInstanceGroup_getIGSurfaceLight(swigCPtr, this), false);
  }

  public void enableRealTimeSunContribution(boolean enable) {
    nel3dJNI.CInstanceGroup_enableRealTimeSunContribution(swigCPtr, this, enable);
  }

  public boolean getRealTimeSunContribution() {
    return nel3dJNI.CInstanceGroup_getRealTimeSunContribution(swigCPtr, this);
  }

  public boolean linkToParent(CInstanceGroup pFather) {
    return nel3dJNI.CInstanceGroup_linkToParent(swigCPtr, this, CInstanceGroup.getCPtr(pFather), pFather);
  }

  public CInstanceGroup getParentClusterSystem() {
    long cPtr = nel3dJNI.CInstanceGroup_getParentClusterSystem(swigCPtr, this);
    return (cPtr == 0) ? null : new CInstanceGroup(cPtr, false);
  }

  public void set_InstancesInfos(SWIGTYPE_p_std__vectorT_NL3D__CInstance_t value) {
    nel3dJNI.CInstanceGroup__InstancesInfos_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CInstance_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CInstance_t get_InstancesInfos() {
    long cPtr = nel3dJNI.CInstanceGroup__InstancesInfos_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CInstance_t(cPtr, false);
  }

  public void set_Instances(SWIGTYPE_p_std__vectorT_NL3D__CTransformShape_p_t value) {
    nel3dJNI.CInstanceGroup__Instances_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CTransformShape_p_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CTransformShape_p_t get_Instances() {
    long cPtr = nel3dJNI.CInstanceGroup__Instances_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CTransformShape_p_t(cPtr, false);
  }

  public void set_Portals(SWIGTYPE_p_std__vectorT_NL3D__CPortal_t value) {
    nel3dJNI.CInstanceGroup__Portals_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CPortal_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CPortal_t get_Portals() {
    long cPtr = nel3dJNI.CInstanceGroup__Portals_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CPortal_t(cPtr, false);
  }

  public void set_ClusterInfos(SWIGTYPE_p_std__vectorT_NL3D__CCluster_t value) {
    nel3dJNI.CInstanceGroup__ClusterInfos_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CCluster_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CCluster_t get_ClusterInfos() {
    long cPtr = nel3dJNI.CInstanceGroup__ClusterInfos_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CCluster_t(cPtr, false);
  }

  public void set_ClusterInstances(SWIGTYPE_p_std__vectorT_NL3D__CCluster_p_t value) {
    nel3dJNI.CInstanceGroup__ClusterInstances_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CCluster_p_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CCluster_p_t get_ClusterInstances() {
    long cPtr = nel3dJNI.CInstanceGroup__ClusterInstances_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CCluster_p_t(cPtr, false);
  }

  public void set_Root(CTransform value) {
    nel3dJNI.CInstanceGroup__Root_set(swigCPtr, this, CTransform.getCPtr(value), value);
  }

  public CTransform get_Root() {
    long cPtr = nel3dJNI.CInstanceGroup__Root_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTransform(cPtr, false);
  }

  public void set_ClipTrav(CClipTrav value) {
    nel3dJNI.CInstanceGroup__ClipTrav_set(swigCPtr, this, CClipTrav.getCPtr(value), value);
  }

  public CClipTrav get_ClipTrav() {
    long cPtr = nel3dJNI.CInstanceGroup__ClipTrav_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CClipTrav(cPtr, false);
  }

  public void set_ClusterSystemForInstances(CInstanceGroup value) {
    nel3dJNI.CInstanceGroup__ClusterSystemForInstances_set(swigCPtr, this, CInstanceGroup.getCPtr(value), value);
  }

  public CInstanceGroup get_ClusterSystemForInstances() {
    long cPtr = nel3dJNI.CInstanceGroup__ClusterSystemForInstances_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CInstanceGroup(cPtr, false);
  }

  public void set_ParentClusterSystem(CInstanceGroup value) {
    nel3dJNI.CInstanceGroup__ParentClusterSystem_set(swigCPtr, this, CInstanceGroup.getCPtr(value), value);
  }

  public CInstanceGroup get_ParentClusterSystem() {
    long cPtr = nel3dJNI.CInstanceGroup__ParentClusterSystem_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CInstanceGroup(cPtr, false);
  }

  public void set_GlobalPos(CVector value) {
    nel3dJNI.CInstanceGroup__GlobalPos_set(swigCPtr, this, CVector.getCPtr(value), value);
  }

  public CVector get_GlobalPos() {
    long cPtr = nel3dJNI.CInstanceGroup__GlobalPos_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public final static int NumStaticLightPerInstance = nel3dJNI.CInstanceGroup_NumStaticLightPerInstance_get();

  public final static class TState {
    public final static TState StateNotAdded = new TState("StateNotAdded", nel3dJNI.CInstanceGroup_StateNotAdded_get());
    public final static TState StateAdding = new TState("StateAdding");
    public final static TState StateAdded = new TState("StateAdded");
    public final static TState StateError = new TState("StateError");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TState swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TState.class + " with value " + swigValue);
    }

    private TState(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TState(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TState(String swigName, TState swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TState[] swigValues = { StateNotAdded, StateAdding, StateAdded, StateError };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
